package cn.edu.scau.dao;

import cn.edu.scau.entity.Booking;
import org.apache.ibatis.jdbc.SQL;

public class BookingSqlProvider {

    public String insertSelective(Booking record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("booking");
        
        if (record.getBookingid() != null) {
            sql.VALUES("bookingID", "#{bookingid,jdbcType=INTEGER}");
        }
        
        if (record.getBookingprepayamount() != null) {
            sql.VALUES("bookingprepayamount", "#{bookingprepayamount,jdbcType=DECIMAL}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(Booking record) {
        SQL sql = new SQL();
        sql.UPDATE("booking");
        
        if (record.getBookingprepayamount() != null) {
            sql.SET("bookingprepayamount = #{bookingprepayamount,jdbcType=DECIMAL}");
        }
        
        sql.WHERE("bookingID = #{bookingid,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}